<!--
Copyright (C) 2012 Martin Řehánek <rehan at mzk.cz>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <!--<link rel="stylesheet" type="text/css" href="css/360player.css"></link>-->
        <!--<link rel="myplayer" type="text/css" href="../css/my_player.css"></link>-->
        <link rel="stylesheet" type="text/css" href="http://localhost:8084/ClosureTest/css/my_player.css"></link>
        <!--<link type="text/css" href="css/my_player.css"></link>-->
        <script src="http://localhost:9810/compile?id=audio&format=RAW"></script>
        <script src="soundmanager/script/soundmanager2.js"></script>
    </head>
    <body>
        <!--<div id="recordDiv"></div>-->
        <!--<img src="img/Record-icon.png" id="recordImg" hidden="hidden"></img>-->


        <!--        <span id="parentForC2"
                      class="goog-inline-block goog-control"
                      style="vertical-align:middle;">
                    Decorated Example
                </span>-->

        <!--        <div id="testDiv" class="play-normal" ></div>
                <img id="testImg" class="play-normal"></img>-->

        <div id="player">
            <span id ="playPauseBtn" ></span>
            <span id ="stopBtn" ></span>
            <span id ="progressBar" class="progressBarSpan"></span>
            <span id ="playlistButton"></span>
            <span id ="volumeBtn" ></span>
            <span id ="volumeSlider" class="volumeSliderSpan"></span>
            <span id ="progressInfo" ></span>
        </div>
        <div id="test">test</div>
        <div id="playlistTest">    
            <span id ="container1" class="test-inline-block" ></span>
            <span id ="container2" ></span>
            <span id ="container3" ></span>
            <span id ="container4" ></span>
            <span id ="container5" ></span>
        </div>

        <div>
            <b>následuje test control :</b><br>
            <span id="testControl"></span>
        </div>

        <img src="ico/record/record_16_16.png"/>




        <!--            <span id ="volumeSlider" ></span>-->

        <!--        <span id ="test" class="buttonSpan" >ahoj</span>-->

        <!--        <div id="volumeSlider" class="goog-slider" style="width: 200px; height: 20px">
                     this line is here just to show that custom content can be added 
                    <div style="position:absolute;width:100%;top:9px;border:1px inset white;
                         overflow:hidden;height:0"></div>
                    <div class="goog-slider-thumb"></div>
                </div>-->

        <script>
            //var hint = goog.dom.getElement('hint');
            //TODO: nahradit opravdovym playerem
            //var player = new kramerius.audio.PlayerMock();
            var controller = new kramerius.audio.Controller(true);
            
            //play/pause
            var playPauseBtnSpan = goog.dom.getElement('playPauseBtn');
            var playPauseButton = new kramerius.audio.ui.PlayPauseButton(playPauseBtnSpan, controller);
            
            //stop
            var stopBtnSpan = goog.dom.getElement('stopBtn');
            var stopButton = new kramerius.audio.ui.StopButton(stopBtnSpan, controller);
            
            //progress bar
            var progressBarSpan = goog.dom.getElement('progressBar');
            var progressBar = new kramerius.audio.ui.ProgressBar(progressBarSpan, controller);
            
            //progress bar
            var progressInfoSpan = goog.dom.getElement('progressInfo');
            var progressInfo = new kramerius.audio.ui.ProgressInfo(progressInfoSpan, controller);
            
            //playlist hide/show
            var playlistButtonSpan = goog.dom.getElement('playlistButton');
            var playlistButton = new kramerius.audio.ui.PlaylistShowHideButton(playlistButtonSpan, controller);
            
            //TADY
            var playlistMenu = new kramerius.audio.ui.playlist.PlaylistMenu(playlistButtonSpan, controller);
            var trackComponent = new kramerius.audio.ui.playlist.TrackComponent(new kramerius.audio.Track("neco","uuid:1", "http://TODO"));
            //var trackComponent = new kramerius.audio.test.Container(new kramerius.audio.Track("neco","uuid:1", "http://TODO"));
            console.log("track component: " + trackComponent.getContainer());
            //playlistMenu.addTrackComponent(container.getContainer());
            playlistMenu.addTrackComponent(container);
            
            ////            var testDiv = goog.dom.getElement('test');
            ////            var playlistMenu = new kramerius.audio.ui.playlist.PlaylistMenu(test, controller);
            //            
            
            //volume
            var volumeBtnSpan = goog.dom.getElement('volumeBtn');
            var volumeButton = new kramerius.audio.ui.VolumeButton(volumeBtnSpan, controller);
            
            //volume slider
            var volumeSliderSpan = goog.dom.getElement('volumeSlider');
            var volumeSlider = new kramerius.audio.ui.VolumeSlider(volumeSliderSpan, controller);
        
        
            var audioPlayer = new kramerius.audio.AudioPlayer(controller);
            var audioProxyUrl = 'http://localhost:8084/K4AudioPOC/AudioServlet';
            //var track = new kramerius.audio.Track('Stalin 4.1', 'uuid:STALIN_4-1', audioProxyUrl);
            var track = new kramerius.audio.Track('Stalin 4.2', 'uuid:STALIN_4-2', audioProxyUrl);
            
            controller.setAudioPlayer(audioPlayer);
            controller.setTrack(track);
            //controller.play();
            
            //            var containerTest = goog.dom.getElement('containerTest');
            //            var container = new kramerius.audio.test.Container(containerTest);

            new kramerius.audio.test.Container(goog.dom.getElement('container1'), "prvni skladba");
            new kramerius.audio.test.Container(goog.dom.getElement('container2'), "druha skladba");
            //            new kramerius.audio.test.Container(goog.dom.getElement('container2'), "druha skladba");
            //            new kramerius.audio.test.Container(goog.dom.getElement('container3'), "treti skladba");
            //            new kramerius.audio.test.Container(goog.dom.getElement('container4'), "ctvrta skladba");
            //            new kramerius.audio.test.Container(goog.dom.getElement('container5'), "pata skladba");
            
            //test control
            var testControlSpan = goog.dom.getElement('testControl');
            
            //            var btn = new kramerius.audio.test.Button("ahoj");
            //            btn.render(testControlSpan);
            
            var trackContainer = new kramerius.audio.ui.playlist.TrackContainer();
            trackContainer.setTrack(track);
            trackContainer.render(testControlSpan);
        </script>


        <!--<img id="pause" src="http://3.bp.blogspot.com/-75ns3v85St0/T36104c9M2I/AAAAAAAADfA/dubBORMgrMk/s1600/pause.gif"/>-->
        <!--        <div class="ui360">
        dynamically-inserted block 
            <div class="ui">
            <canvas class="sm2-canvas"></canvas>
            <span class="sm2-360btn"></span> 
            <div class="sm2-timing"></div>
            <div class="sm2-cover"></div>
            </div>
            /UI 
            <a href="http://localhost:8084/K4AudioPOC/AudioServlet/uuid:124/MP3">
            </div>-->
        <!--<script src="soundmanager/animator/animator.js"></script>-->


        <script>
            //TODO: inicializovat v audioPlayer.js
            //            soundManager.setup({
            //                // where to find flash SWFs, as needed
            //                url: 'soundmanager/swf'});

            //            var player = new kramerius.audio.AudioPlayer();
            //            var audioProxyUrl = 'http://localhost:8084/K4AudioPOC/AudioServlet';
            //            var track = new kramerius.audio.Track('Stalin 4.1', 'uuid:STALIN_4-1', audioProxyUrl);
            //  player.playTrack(track);
                    
            //                        
            //                    var audioProxyUrl = 'http://localhost:8084/K4AudioPOC/AudioServlet';
            //                    var tracks = [
            //                        new kramerius.audio.Track('Stalin 4.1', 'uuid:STALIN_4-1', audioProxyUrl),
            //                        new kramerius.audio.Track('Stalin 1.1', 'uuid:STALIN_1-1', audioProxyUrl),
            //                        new kramerius.audio.Track('Stalin 1.2', 'uuid:STALIN_1-2', audioProxyUrl),
            //                        new kramerius.audio.Track('Stalin 2.1', 'uuid:STALIN_2-1', audioProxyUrl),
            //                    ];
            //                    //playlist 
            //                    var playlist = new kramerius.audio.Playlist(tracks);
            //                    playlist.play(0);
            //                    //pause
            //                    function showRotatingRecord(playlist) {
            //                        var recordDiv = document.getElementById('recordDiv');
            //                        var recordImg = document.getElementById('recordImg');
            //                        cz.mzk.kramerius.audio.image.appendRotatingImage(recordDiv, recordImg, playlist);
            //                    }
            //showRotatingRecord(playlist);
        </script>
        <!--        <script>
                    soundManager.audioFormats.mp3.required = true;
                    //soundManager.useHTML5Audio = true;
                    //soundManager.preferFlash = false;
                    soundManager.preferFlash = true;
                    //soundManager.html5Only=true;
                    soundManager.setup({
                        // where to find flash SWFs, as needed
                        url: 'soundmanager/swf',
                        //useFlashBlock: true,
                        onready: function() {
                            var mySound = soundManager.createSound({
                                id: 'aSound',
                                // url: 'http://iris.mzk.cz/cache/audio/files/STALIN_shellack/STALIN_1_1.mp3'
                                // url: 'http://iris.mzk.cz/cache/audio/files/STALIN_shellack/STALIN_1_1.ogg'
                                url: [
                                    'http://iris.mzk.cz/cache/audio/files/STALIN_shellack/STALIN_1_2.ogg',
                                    'http://iris.mzk.cz/cache/audio/files/STALIN_shellack/STALIN_1_2.mp3'
                                ]
                                // onload: function() { console.log('sound loaded!', this); }
                                // other options here..
                            });
                            
                            //                    soundManager.useHTML5Audio = true;
                            //                    soundManager.preferFlash = false;
                            //                    soundManager.html5Only=true;
                            //console.log("available formats:" + soundManager.audioFormats);
                            mySound.play();
        
                        }
                        onfinish: function(){
                            
                        }
                    });
                </script>-->
    </body>
</html>
